/**
 *{"id":"863100065518932","time":"5","version":"1.0","params":{"CurrentTemperature":{"value":24.9},"CurrentHumidity":{"value":42}}}
 */

const data = {
    "id": "863100065518932",
    "time": "5",
    "version": "1.0",
    "params": {"CurrentTemperature": {"value": 24.9}, "CurrentHumidity": {"value": 42}}
}

const device = {
    deviceCode: "863100065518932",
    points: [{path: "CurrentTemperature"}, {path: "CurrentTemperature"}, {path: "aaa"}]
}
const json = {device, data}
const res = f(json)
console.log(JSON.stringify(res))
function f(val) {
    const _ = require('lodash');
    const {device, data} = val
    const {id, params} = data;
    const {deviceCode, points} = device;
    if (id !== deviceCode) {
        return {errorCode: 1}
    }
    _.map(points, item => {
        const {path} = item;
        const p = params[path]
        if (p) {
            item['value'] = p['value']
        }

    })
    return {errorCode: -1, device}
}